import java.util.Scanner;

public class Text {

    public static int countSegments(String s) {
        s = s.trim();
        if(s.equals("")){
            return 0;
        }

        int val = 1;

        for (int i = 0; i < s.length(); i++) {
            if(s.charAt(i) == ' ' && s.charAt(i+1) != ' '){
                val++;
            }
        }

        return val;
    }

    public static void main(String[] args) {
        //统计字符串中的单词个数，这里的单词指的是连续的不是空格的字符。
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();

        int tmp = countSegments(s);

        System.out.println(tmp);


    }
}
